// const baseURL = 'http://api.eyunzhu.com'

// const request = ({url, data, method='GET'}) => {
// 	return new Promise((resolve, reject) => {
// 		uni.request({
// 			url: baseURL + url,
// 			data,
// 			method,
// 			success: res => {
// 				resolve(res)
// 			},
// 			fail: err => {
// 				reject(err)
// 			}
// 		})
// 	})
// }

// const get = url => request({
// 	url,
// 	method: 'GET'
// })

// const post = (url, data) => request({
// 	url,
// 	data,
// 	method: 'POST'
// })

// export {
// 	request,
// 	get,
// 	post
// }

export const gethomelist = () => {
	return new Promise((resolve, reject) => {
		uni.request({
			url: 'http://api.eyunzhu.com/api/vatfs/baidu_top',
			success: (res) => {
				resolve(res)
			},
			fail:(err) => {
				reject(err)
			}
		})
	})
}

export const gethometvlist = (name) => {
	return new Promise((resolve, reject) => {
		uni.request({
			url: `https://api.eyunzhu.com/api/vatfs/resource_site_collect/search?kw=${name}&per_page=50&page=`,
			success: (res) => {
				resolve(res)
			},
			fail:(err) => {
				reject(err)
			}
		})
	})
}

export const getplay = (id) => {
	return new Promise((resolve, reject) => {
		uni.request({
			url: `https://api.eyunzhu.com/api/vatfs/resource_site_collect/getVDetail?vid=${id}`,
			success: (res) => {
				resolve(res)
			},
			fail:(err) => {
				reject(err)
			}
		})
	})
}
